package com.zte.cl.service;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

import com.zte.cl.model.News;
import com.zte.cl.service.task.ContenPageTask;

@Service
public class ContentPageService {
	
	public final static Logger log = Logger.getLogger(ContentPageService.class);

	@Resource(name = "contentPageThreadPool")
	private ThreadPoolTaskExecutor contentPageThreadPool;
	
	public void execute() {
		News news = NewsQueue.poll();
		if (news != null) {
			contentPageThreadPool.execute(new ContenPageTask(news));
		} else {
			log.warn("NewsQueue队列为空");
		}
	}
}
